package io.github.shenbinglife.springboot2.layui.admin.entity;

import io.github.shenbinglife.springboot2.layui.common.model.BaseEntity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

@Entity
@Table(name = "tbl_sys_role")
public class Role extends BaseEntity {
    private String name;
    private String code;
    private String description;
    private String scope;
    @Column(columnDefinition = "TINYINT(1)")
    private Boolean enabled;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getScope() {
        return scope;
    }

    public void setScope(String scope) {
        this.scope = scope;
    }

    public Boolean getEnabled() {
        return enabled;
    }

    public void setEnabled(Boolean enabled) {
        this.enabled = enabled;
    }

    public Dict toDict() {
        Dict dict = new Dict();
        dict.setType(this.scope);
        dict.setTypeName(this.scope);
        dict.setCode(String.valueOf(this.getId()));
        dict.setCodeName(this.name);
        return dict;
    }
}
